package cn.doitedu.spark

import org.apache.spark.SparkContext
import org.apache.spark.rdd.RDD
import org.apache.spark.sql.SparkSession

object SparkMemory {
  def main(args: Array[String]): Unit = {

    val spark: SparkSession = SparkSession.builder()
      .appName("")
      .master("local[*]")
      .config("spark.default.parallelism", "1")
      .getOrCreate()

    val sc: SparkContext = spark.sparkContext

    val rdd: RDD[Int] = sc.makeRDD(1 to 409600000)

    rdd.cache()

    rdd.count()

    Thread.sleep(Long.MaxValue)

    spark.close()
  }
}
